<template>
	<view class="container">
		<view class="roles">
			<view class="role flex-x-bet-y-center" v-for="(item, index) in roles" :key="index" @tap="$myUni.navTo(item.url)">
				<view class="flex-y-center">
					<image :src="item.icon" mode=""></image>
					<text>{{item.title}}</text>
				</view>
				<u-icon name="arrow-right"></u-icon>
			</view>
		</view>
	</view>
</template>

<script>
	export default {
		data() {
			return {
				isWxReg: false, // 是否是微信注册
				roles: [{
						title: '企业账号',
						icon: '/static/images/icon-enterprise.png',
						url: '/pages/user/register-enterprise?isWxReg='
					},
					{
						title: '个人账号',
						icon: '/static/images/icon-user.png',
						url: '/pages/user/register-user?isWxReg='
					}
				]
			};
		},
		onLoad(option){
			this.isWxReg = !!option.isWxReg || false
			// 微信注册
			if(this.isWxReg){
				this.roles.forEach(item => {
					item.url += 'true'
				})
			}
		}
	}
</script>

<style lang="scss">
	.roles {
		margin: 0 30rpx;
		padding-top: 1rpx;
		
		.role{
			background: #FFFFFF;
			border-radius: 19rpx;
			padding: 50rpx;
			font-size: 33rpx;
			color: #333333;
			margin-top: 30rpx;
			
			image{
				width: 80rpx;
				height: 80rpx;
				margin-right: 40rpx;
			}
		}
	}
</style>